package proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: DRevelation
 * @Date: 2021/3/31 17:33
 */
public class DebugInvocationHandler implements InvocationHandler {

    private Object target;

    public DebugInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("======before method======");
        Object result = method.invoke(target, args);
        System.out.println("======after method======");
        return result;
    }
}
